////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include "Tools/GLHeaders.hpp"
#include <iostream>
#include <cstdlib>

#include "Global.hpp"
#include "Glut/ReshapeFunc.hpp"
#include "Glut/DisplayFunc.hpp"
#include "Glut/IdleFunc.hpp"
#include "Glut/InitGLFunc.hpp"
//Peripheric Event
#include "Glut/Keyboard.hpp"
#include "Glut/Special.hpp"
#include "Glut/Mouse.hpp"
#include "Glut/Motion.hpp"

#if DEBUG
  #include "Tools/Debug.hpp"
#endif
////////////////////////////////////////////////////////////
/// Entry point of application
////////////////////////////////////////////////////////////
int main(int argc, char** argv){
  GlobalInit();
  glutInit(&argc, argv);  
  glutInitDisplayMode(GLUT_RGBA|GLUT_ALPHA|GLUT_DOUBLE|GLUT_DEPTH);  
  glutInitWindowPosition(window.x, window.y);  
  glutInitWindowSize(window.width, window.height);  
  window.id = glutCreateWindow(name);  

  glutSetWindow(window.id);
  glutReshapeFunc(&ReSizeGLScene);
  glutDisplayFunc(&DrawGLScene);  
  glutIdleFunc(&SleepGLScene);
  if(fullscreen)
    glutFullScreen();
  glutKeyboardFunc(&Keyboard);
  glutKeyboardUpFunc(&KeyboardUp);

  glutSpecialFunc(&Special);
  glutSpecialUpFunc(&SpecialUp);

  glutMouseFunc(&Mouse);
  glutMotionFunc(&Motion);
  glutPassiveMotionFunc(&PassiveMotion);

  glewInit();
  InitGL(window.width, window.height);
#if DEBUG
  DebugInfo(stderr);
#endif
  glutMainLoop();
  return EXIT_SUCCESS; // never reach...
}
